using UnityEngine;
using System.Collections;

public class ResolveNuke : MonoBehaviour {

	public void Boom() {
		Health[] hs = GameObject.FindObjectsOfType<Health>();

		foreach(Health h in hs) {
			if(h.gameObject.layer != 10)
				continue;

			if(h.hps <= GameManager.Instance.nukeDamage) {
				Destroy(h.gameObject);
			}
			else {
				h.TakeDamage(GameManager.Instance.nukeDamage);
			}
		}

		BulletBehaviour[] bs = GameObject.FindObjectsOfType<BulletBehaviour>();
		foreach(BulletBehaviour b in bs) {
			if(b.gameObject.layer != 11)
				continue;

			Destroy(b.gameObject);
		}
	}
}
